﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace FundRaising.GUI
{
  
    public partial class FundRaisingMasterPage : System.Web.UI.MasterPage
    {
        public static int r = 1;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.IsAuthenticated)
                Response.Redirect("~/GUI/Login/Login.aspx");
            FormsIdentity identity = HttpContext.Current.User.Identity as FormsIdentity;
            String username = identity.Name;

            bool userRole = HttpContext.Current.User.IsInRole("user"); 
  ClearButtonsBg(r);
        }

        private void ClearButtonsBg(int r)
        {
            switch (r)
            {
                case 1:
                    {
                        this.Button1.CssClass = "styleBtnOn";
                        this.Button2.CssClass = "styleBtnOff";
                        this.Button3.CssClass = "styleBtnOff";
                        this.Button4.CssClass = "styleBtnOff";
                    }
                    break;
                case 2:
                    {
                        this.Button1.CssClass = "styleBtnOff";
                        this.Button2.CssClass = "styleBtnOn";
                        this.Button3.CssClass = "styleBtnOff";
                        this.Button4.CssClass = "styleBtnOff";
                    }
                    break;
                case 3:
                    {
                        this.Button1.CssClass = "styleBtnOff";
                        this.Button2.CssClass = "styleBtnOff";
                        this.Button3.CssClass = "styleBtnOn";
                        this.Button4.CssClass = "styleBtnOff";
                    }
                    break;
                case 4:
                    {
                        this.Button1.CssClass = "styleBtnOff";
                        this.Button2.CssClass = "styleBtnOff";
                        this.Button3.CssClass = "styleBtnOff";
                        this.Button4.CssClass = "styleBtnOn";
                    }
                    break;
                default:
                    {
                    }
                    break;
            }
            
        }



        protected void Button1_Click(object sender, EventArgs e)
        {
            r = 1;
             
            Response.Redirect("EditAsso.aspx");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {

            r = 2;
            
            Response.Redirect("EditFund2.aspx");
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            r = 3;
            
            Response.Redirect("EditRequest.aspx");
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            r = 4;
            
            Response.Redirect("EditReport.aspx");
        }









        /*     protected void Button4_Click(object sender, EventArgs e)
             {
                 ClearButtonsBg();
                 this.Button4.CssClass = "style2";
                 Response.Redirect("WebForm4.aspx");
             }*/

    }
} 
        